package com.csdj.t309.geamtest.controller;

import com.csdj.t309.geamtest.common.CacheConstant;
import com.csdj.t309.geamtest.common.WebResult;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 23793
 */
public class BaseController {
    public int getUid(HttpServletRequest request){
        String header = request.getHeader(CacheConstant.HEADER_UID);
        if(StringUtils.hasText(header)){
            return Integer.parseInt(header);
        }
        return 0;
    }

    public WebResult resp(int code, Object data){
        return new WebResult(code,data);
    }
}
